package org.whut.practice.utils;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class Response {
    public static <T> Map<String, Object> makeOkResponse(T data, String message) {
        HashMap<String, Object> responseMap = new HashMap<>();
        responseMap.put("code", 200);
        responseMap.put("message", message);
        responseMap.put("data", data);
        return responseMap;
    }

    public static Map<String, Object> makeErrorResponse(String message) {
        HashMap<String, Object> responseMap = new HashMap<>();
        responseMap.put("code", 500);
        responseMap.put("message", message);
        return responseMap;
    }
}
